<?php

/**
 * This is the model class for table "jumlahternakpotong".
 *
 * The followings are the available columns in table 'jumlahternakpotong':
 * @property integer $jtp_id
 * @property integer $jtp_kec
 * @property integer $jtp_sapi
 * @property integer $jtp_kerbau
 * @property integer $jtp_kambing
 * @property integer $jtp_domba
 * @property integer $jtp_babi
 * @property integer $jtp_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $jtpKec
 */
class Jumlahternakpotong extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Jumlahternakpotong the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'jumlahternakpotong';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('jtp_kec, jtp_sapi, jtp_kerbau, jtp_kambing, jtp_domba, jtp_babi, jtp_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('jtp_id, jtp_kec, jtp_sapi, jtp_kerbau, jtp_kambing, jtp_domba, jtp_babi, jtp_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'jtpKec' => array(self::BELONGS_TO, 'Kecamatan', 'jtp_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'jtp_id' => 'Jtp',
			'jtp_kec' => 'Jtp Kec',
			'jtp_sapi' => 'Sapi',
			'jtp_kerbau' => 'Kerbau',
			'jtp_kambing' => 'Kambing',
			'jtp_domba' => 'Domba',
			'jtp_babi' => 'Babi',
			'jtp_tahun' => 'Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('jtp_id',$this->jtp_id);
		$criteria->compare('jtp_kec',$this->jtp_kec);
		$criteria->compare('jtp_sapi',$this->jtp_sapi);
		$criteria->compare('jtp_kerbau',$this->jtp_kerbau);
		$criteria->compare('jtp_kambing',$this->jtp_kambing);
		$criteria->compare('jtp_domba',$this->jtp_domba);
		$criteria->compare('jtp_babi',$this->jtp_babi);
		$criteria->compare('jtp_tahun',$this->jtp_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}